package cn.bs.allensocket;

import java.net.DatagramPacket;
import java.net.InetAddress;

/**
 * Created by Allen on 2014/11/1.
 */
public class AllenDgram {
    public static DatagramPacket toDataGram(String str,InetAddress destIA,int destport){
        byte[] buf = new byte[str.length() + 1];
        return new DatagramPacket(buf,buf.length ,destIA,destport);
    }
    public static String toString(DatagramPacket p){
        return new String(p.getData(),0,p.getLength());
    }
}
